<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>编辑网站·思通投研·让数据驱动投资价值!</title>
	<link href="${pageContext.request.contextPath }/img/webLogoIcon.png" rel="shortcut icon">
    <link href="${pageContext.request.contextPath }/css/bootstrap.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/css/font-awesome.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/css/custom.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/css/animate.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/css/style.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/css/datatables.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/css/datepicker3.css" rel="stylesheet">
	<link href="${pageContext.request.contextPath }/css/toastr.min.css" rel="stylesheet" />
	<!-- toastr -->
	<link href="${pageContext.request.contextPath }/css/toastr.min.css" rel="stylesheet" />
    <style>
		.left{
		    float:left;
		    width:33%;
		}
		.form-horizontal{
			width: 95%;
		}
		.form-control{
			width: 30%;
		}
		.col-sm-2{
			height: 50px;
		}
	</style>
</head>

<body>

    <div id="wrapper">

        <nav class="navbar-default navbar-static-side" role="navigation">
            <%request.setAttribute("LEFT", "foreignwebsitelist");%>
			<%@include file="left.jsp"%>
        </nav>

        <div id="page-wrapper" class="gray-bg">
        <div class="row border-bottom">
        <jsp:include page="head.jsp" flush="true" /> 
        </div>
            <div class="row wrapper border-bottom white-bg page-heading">
                <div class="col-lg-10">
                    <h2>编辑网站</h2>
                </div>
            </div>
        <div class="wrapper wrapper-content">
            <div class="ibox-content">
            	<button class="btn btn-white pull-right" onclick="window.history.go(-1);" type="button">返回</button>
                <div class="table-responsive" style="margin-top: 5%;">
                    <div class="panel-body">
                           <fieldset class="form-horizontal">
                               <div class="form-group"><label class="col-sm-2 control-label">网站类型:</label>
                                   <div class="col-sm-10">
                                   <select class="form-control" style="display: inline;width: 35%;"
											id="website_type">
											<option value="1" ${website.website_type==1?"selected='selected'":''}>政府网站</option>
											<option value="2" ${website.website_type==2?"selected='selected'":''}>企业网站</option>
											<option value="3" ${website.website_type==3?"selected='selected'":''}>商业网站</option>
											<option value="4" ${website.website_type==4?"selected='selected'":''}>教育科研机构网站</option>
											<option value="5" ${website.website_type==5?"selected='selected'":''}>个人网站</option>
											<option value="6" ${website.website_type==6?"selected='selected'":''}>其它非盈利机构网站</option>
											<option value="7" ${website.website_type==7?"selected='selected'":''}>其它类型</option>
									</select>
                                   </div>
                               </div>
                               <div class="form-group"><label id="webSiteId" data-id="${website.id }" class="col-sm-2 control-label">网站名称:</label>
                                   <div class="col-sm-10"><input type="text" class="form-control" id="website_name" value="${website.website_name }" style="width: 88%;" placeholder="请输入网站名称"></div>
                               </div>
                               <div class="form-group"><label class="col-sm-2 control-label">网站地址:</label>
                                   <div class="col-sm-10"><input type="text" class="form-control" id="website_url" value="${website.website_url }" style="width: 88%;" placeholder="请输入网站地址"></div>
                               </div>
                               <div class="form-group"><label class="col-sm-2 control-label">网站logo:</label>
                                   <div class="col-sm-10"><input type="text" class="form-control" id="website_logo" value="${website.website_ico }" style="width: 88%;" placeholder="请输入网站logo"></div>
                               </div>
                               <div class="form-group"><label class="col-sm-2 control-label">网站服务器所在省:</label>
                                   <div class="col-sm-10"><input type="text" class="form-control" id="website_province" value="${website.website_province }" style="width: 88%;" placeholder="网站服务器所在省"></div>
                               </div>
                               <div class="form-group"><label class="col-sm-2 control-label">网站服务器所在市:</label>
                                   <div class="col-sm-10"><input type="text" class="form-control" id="website_city" value="${website.website_city }" style="width: 88%;" placeholder="网站服务器所在市"></div>
                               </div>
                               <div class="form-group"><label class="col-sm-2 control-label">列表页url包含规则:</label>
                                   <div class="col-sm-10"><input type="text" class="form-control" id="url_contains_str" value="${website.url_contains_str }" style="width: 88%;" placeholder="列表页url必须包含字段以,分割"></div>
                               </div>
                               <div class="form-group"><label class="col-sm-2 control-label">列表页url屏蔽规则:</label>
                                   <div class="col-sm-10"><input type="text" class="form-control" id="url_shield_str" value="${website.url_shield_str }" style="width: 88%;" placeholder="列表页url屏蔽字段以,分割"></div>
                               </div>
                               <div class="form-group"><label class="col-sm-2 control-label">列表页名称规则:</label>
                                   <div class="col-sm-10"><input type="text" class="form-control" id="explain_contains_str" value="${website.explain_contains_str }" style="width: 88%;" placeholder="列表页名称必须包含字段以,分割"></div>
                               </div>
                               <div class="form-group"><label class="col-sm-2 control-label">列表页屏蔽规则:</label>
                                   <div class="col-sm-10"><input type="text" class="form-control" id="explain_shield_str" value="${website.explain_shield_str }" style="width: 88%;" placeholder="列表页屏蔽字段以,分割"></div>
                               </div>
                               <div class="form-group"><label class="col-sm-2 control-label">网站备注:</label>
                                   <div class="col-sm-10">
                                       <textarea class="form-control " id="website_remark" style=" height:100px;width: 88%;" placeholder="请输入网站备注">${website.website_remark }</textarea>
                                   </div>
                               </div>
                           </fieldset>
                           <button class="btn btn-primary"style="margin-left: 45%;margin-top: 2%;" onclick="updateWebSite()" type="button">确定编辑网站</button>
                       </div>
                   </div>
                </div>
            </div>
		<jsp:include page="footer.jsp" flush="true" />
        </div>
        </div>



    <!-- Mainly scripts -->
    <script src="${pageContext.request.contextPath }/js/jquery-2.1.1.js"></script>
    <script src="${pageContext.request.contextPath }/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath }/js/jquery.metisMenu.js"></script>
    <script src="${pageContext.request.contextPath }/js/jquery.slimscroll.min.js"></script>
    <script src="${pageContext.request.contextPath }/js/jquery.jeditable.js"></script>
    <script src="${pageContext.request.contextPath }/js/datatables.min.js"></script>
    
    <!-- Peity -->
    <script src="${pageContext.request.contextPath }/js/jquery.peity.min.js"></script>

    <!-- Custom and plugin javascript -->
    <script src="${pageContext.request.contextPath }/js/inspinia.js"></script>
    <script src="${pageContext.request.contextPath }/js/pace.min.js"></script>

    <!-- Peity -->
    <script src="${pageContext.request.contextPath }/js/peity-demo.js"></script>
    
	<!-- toastr -->
	<script src="${pageContext.request.contextPath }/js/plugins/toastr/toastr.min.js"></script>


    <!-- Page-Level Scripts -->
    <script>
    function updateWebSite(){
    	if($("#website_name").val()==null||$("#website_name").val()=="")
    	{
    		toastr.error('请输入网站名称')
    		return;
    	}else if($("#website_url").val()==null||$("#website_url").val()=="")
    	{
    		toastr.error('请输入网站地址')
    		return;
    	}else if($("#website_province").val()==null||$("#website_province").val()==""){
    		toastr.error('请输入网站服务器所在省')
    		return;
    	}else if($("#website_city").val()==null||$("#website_city").val()==""){
    		toastr.error('请输入网站服务器所在市')
    		return;
    	}
    	$.ajax({
    		url : "${pageContext.request.contextPath}/website/updateforeignwebsite",
    		type : "post",
    		data : {
    			id : $("#webSiteId").attr("data-id"),
    			website_type : $("#website_type").val(),
    			website_name : $("#website_name").val(),
    			website_url : $("#website_url").val(),
    			url_contains_str : $("#url_contains_str").val(),
    			url_shield_str : $("#url_shield_str").val(),
    			explain_contains_str : $("#explain_contains_str").val(),
    			website_province:$("#website_province").val(),
    			website_city:$("#website_city").val(),
    			website_logo:$("#website_logo").val(),
    			explain_shield_str : $("#explain_shield_str").val(),
    			website_remark : $("#website_remark").val()
    		},
    		success : function(res) {
    			console.log(res)
    			if (res.status == 200) {
    				toastr.success(res.msg);
    				setTimeout(function () {
    					window.location.href = "${pageContext.request.contextPath}/foreignlistseed?websiteId="+$("#webSiteId").attr("data-id");
    				}, 1000);
    			} else {
    				alert(res.msg)
    			}
    		},
    		error : function(e) {
    			toastr.error('错误');
    			window.clearInterval(timer);
    		}
    	});
    }
    
    
  //跑马灯方法 
// 	 function init(){
// 		    //获取标题
// 		    var title=document.title;
// 		    //分割字符串--->字符数组
// 		    var arr=title.split("");
// 		    //删除第一个元素并返回该元素
// 		    var e=arr.shift();
// 		    //把一个对象添加到数组末尾
// 		    arr.push(e);
// 		    //把数组转换成字符串
// 		    var marquee=arr.join("");
// 		    //返回给浏览器
// 		    document.title=marquee;
// 		    //定时一直执行
// 		    window.setTimeout("init()",1000);
// 		}
// 		window.onload=init;
	 
    </script>

</body>

</html>
